<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>优惠券码</title>
    <meta name="viewport" content="user-scalable=no">
  	<meta http-equiv="pragma" content="no-cache">
  	<meta http-equiv="cache-control" content="no-cache">
  	<meta http-equiv="expires" content="0">
  	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
  	<meta http-equiv="description" content="This is my page">
    <link rel="stylesheet" type="text/css" href="static/weixin/css/common.css">
    <link rel="stylesheet" type="text/css" href="static/weixin/font/css/font-awesome.css">
    <script type="text/javascript" src="static/weixin/js/jquery-2.1.3.min.js"></script>
    <script type="text/javascript" src="static/weixin/plug/JsBarcode/JsBarcode.all.min.js"></script>
    <script type="text/javascript" src="static/weixin/plug/qrcode/jquery.qrcode.min.js"></script>
    <script type="text/javascript" src="static/weixin/js/myJs.js"></script>
  </head>

  <body class="coupon_code_body">
  	<div class="barcode_page">
  		<p>优惠码</p>
	    <div id="code" class="barcode_qr"></div>
	    <canvas id = "barcode" style="width: 100%;"/>
  	</div>
    

    <script type="text/javascript">
    	var code = '${pd.code }';
    	$("#code").qrcode({
			render: "canvas", //canvas table方式
			width: 350, //宽度
			height:350, //高度
			//typeNumber: -1,      //计算模式
			//correctLevel: QRErrorCorrectLevel.H,//纠错等级
			background: "#ffffff",	//背景颜色
			foreground: "#000000", //前景颜色
			text: code	//任意内容
		});
		var code_t = "";
		for(var i = 0; i < code.length; i+=4){
			code_t += code.substring(i-4,i) + " ";
			if(i+4 > code.length) {code_t += code.substring(i,code.length);}
		}
    	$("#barcode").JsBarcode(code, {
			format: "CODE39",//选择要使用的条形码类型
			width: 2,//设置条之间的宽度
			height: 150,//高度
			displayValue: true,//是否在条形码下方显示文字
			text: code_t,//覆盖显示的文本
			/* fontOptions: "bold",//使文字加粗体或变斜体 "bold italic" */
			font: "微软雅黑",//设置文本的字体
			textAlign: "center",//设置文本的水平对齐方式
			textPosition: "button",//设置文本的垂直位置
			textMargin: 5,//设置条形码和文本之间的间距
			fontSize: 40,//设置文本的大小
			//background: "#eee",//设置条形码的背景
			//lineColor: "#77AFB5",//设置条和文本的颜色。
			margin: 30//设置条形码周围的空白边距
		});
    </script>
  </body>
</html>
